import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '127.0.0.1',
    port: 8080,
    open: true,
    proxy: {
      '/api': {   // 以api开头的跳转到9000端口上
        target: 'http://127.0.0.1:9000',
        changeOrigin: true,   // 跨域
        rewrite: (path) => path.replace(/^\/api/, '') // 路径重写
      },
    }
  }
})
